util.c: add case_ignore_strncmp
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 23 Jan 2005 04:19:50 +0000 (04:19 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 23 Jan 2005 04:19:50 +0000 (04:19 +0000)
gpsbabel/util.c

index 69f0d9370b07a14293c80c3499d669d707e85fa7..165453a3ef1868fea196eb71fed5916cd71de394 100644 (file)
@@ -326,6 +326,20 @@ case_ignore_strcmp(const char *s1, const char *s2)
 
 }
 
+int 
+case_ignore_strncmp(const char *s1, const char *s2, int n)
+{
+       int rv = 0;
+
+       while (n && ((rv = toupper(*s1) - toupper(*s2)) == 0)
+               && *s1) {
+               s1++;
+               s2++;
+               n--;
+       }
+       return rv;
+}
+
 void
 printposn(const double c, int is_lat)
 {